import java.util.ArrayList;
/**
 * The Band is a Sub-class of Performance, you can, added to the features of Performance, define/get it's playlist
 * 
 * @author Mathieu Reymond & Jonathan Smet
 * @version 11/05/11
 */
public class Band extends Performance
{
    private String musicType;
    private ArrayList<Song> playlist = new ArrayList<Song>();

    /**
     * Create a new Band
     * 
     * @param title The name of the band
     * @param description A short description of the band
     * @param podium The place where the band will perform
     * @param musicType The music style the band is playing 
     */
    public Band(String title, String description, String podium, String musicType)
    {
        super(title, "Band", description, podium);
        this.musicType = musicType;
    }
    
    /**
     * Add a song to the band's playlist
     * 
     * @param Song The song to add
     */
    public void addSong(Song song)
    {
        playlist.add(song);
        super.setDuration(duration());
    }
    
    /**
     * Give the total duration (in seconds) of the playlist
     * 
     * @return The total duration (in seconds) of the playlist
     */
    private int duration()
    {
        int duration = 0;
        
        for(int index = 0; index < playlist.size(); index++)
        {
            duration += playlist.get(index).getTime();
        }
        
        return duration;
    } 
    
    /**
     * Give a String of the playlist " title (minutes : seconds) "
     * 
     * @return A String of the playlist " title (minutes : seconds) "
     */
    public String showPlaylist()
    {
        String playlistInfo = "";
        
        for(int index = 0; index < playlist.size(); index++)
        {   
            playlistInfo += playlist.get(index).getTitle() + " (" + playlist.get(index).getMinutes() + " : " + playlist.get(index).getSeconds() + ") \n                 ";
        }
        
        return playlistInfo;
    }
     /**
     * Give a String of the Details
     * 
     * @return A String of the Details
     */
    public String getDetails()
    {
        String details = "";
        details += super.getDetails() + "Playlist : " + showPlaylist();
        return details;
    }

}
